/**
 *
 * Access (ABM), 2017-2019, 单创.
 */
package com.tengju.bff.interfaces.covercharge.service.message.code;

import org.apache.thrift.TBase;
import org.apache.thrift.protocol.*;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;

import javax.annotation.Generated;
import java.io.Serializable;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
/**
 * 消息动作
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.13.0)", date = "2020-03-18")
public class MessageAction implements TBase<MessageAction, MessageAction._Fields>, Serializable, Cloneable, Comparable<MessageAction> {
  private static final TStruct STRUCT_DESC = new TStruct("MessageAction");

  private static final TField TYPE_FIELD_DESC = new TField("type", TType.I32, (short)1);
  private static final TField GOODS_ID_FIELD_DESC = new TField("goodsId", TType.I32, (short)2);
  private static final TField TITLE_FIELD_DESC = new TField("title", TType.STRING, (short)3);
  private static final TField CONTENT_FIELD_DESC = new TField("content", TType.STRING, (short)4);
  private static final TField LINK_FIELD_DESC = new TField("link", TType.STRING, (short)5);
  private static final TField SHARE_TITLE_FIELD_DESC = new TField("shareTitle", TType.STRING, (short)6);
  private static final TField SHARE_CONTENT_FIELD_DESC = new TField("shareContent", TType.STRING, (short)7);
  private static final TField SHARE_IMAGE_URL_FIELD_DESC = new TField("shareImageUrl", TType.STRING, (short)8);
  private static final TField SHARE_LINK_URL_FIELD_DESC = new TField("shareLinkUrl", TType.STRING, (short)9);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new MessageActionStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new MessageActionTupleSchemeFactory();

  /**
   * 
   * @see MessageActionType
   */
  public @org.apache.thrift.annotation.Nullable MessageActionType type; // required
  public int goodsId; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String title; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String content; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String link; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String shareTitle; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String shareContent; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String shareImageUrl; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String shareLinkUrl; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     *
     * @see MessageActionType
     */
    TYPE((short)1, "type"),
    GOODS_ID((short)2, "goodsId"),
    TITLE((short)3, "title"),
    CONTENT((short)4, "content"),
    LINK((short)5, "link"),
    SHARE_TITLE((short)6, "shareTitle"),
    SHARE_CONTENT((short)7, "shareContent"),
    SHARE_IMAGE_URL((short)8, "shareImageUrl"),
    SHARE_LINK_URL((short)9, "shareLinkUrl");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // TYPE
          return TYPE;
        case 2: // GOODS_ID
          return GOODS_ID;
        case 3: // TITLE
          return TITLE;
        case 4: // CONTENT
          return CONTENT;
        case 5: // LINK
          return LINK;
        case 6: // SHARE_TITLE
          return SHARE_TITLE;
        case 7: // SHARE_CONTENT
          return SHARE_CONTENT;
        case 8: // SHARE_IMAGE_URL
          return SHARE_IMAGE_URL;
        case 9: // SHARE_LINK_URL
          return SHARE_LINK_URL;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __GOODSID_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.GOODS_ID, _Fields.TITLE, _Fields.CONTENT, _Fields.LINK, _Fields.SHARE_TITLE, _Fields.SHARE_CONTENT, _Fields.SHARE_IMAGE_URL, _Fields.SHARE_LINK_URL};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
        new org.apache.thrift.meta_data.EnumMetaData(TType.ENUM, MessageActionType.class)));
    tmpMap.put(_Fields.GOODS_ID, new org.apache.thrift.meta_data.FieldMetaData("goodsId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.I32)));
    tmpMap.put(_Fields.TITLE, new org.apache.thrift.meta_data.FieldMetaData("title", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.CONTENT, new org.apache.thrift.meta_data.FieldMetaData("content", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.LINK, new org.apache.thrift.meta_data.FieldMetaData("link", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.SHARE_TITLE, new org.apache.thrift.meta_data.FieldMetaData("shareTitle", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.SHARE_CONTENT, new org.apache.thrift.meta_data.FieldMetaData("shareContent", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.SHARE_IMAGE_URL, new org.apache.thrift.meta_data.FieldMetaData("shareImageUrl", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    tmpMap.put(_Fields.SHARE_LINK_URL, new org.apache.thrift.meta_data.FieldMetaData("shareLinkUrl", org.apache.thrift.TFieldRequirementType.OPTIONAL,
        new org.apache.thrift.meta_data.FieldValueMetaData(TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MessageAction.class, metaDataMap);
  }

  public MessageAction() {
    this.title = "";

    this.content = "";

    this.link = "";

    this.shareTitle = "";

    this.shareContent = "";

    this.shareImageUrl = "";

    this.shareLinkUrl = "";

  }

  public MessageAction(
    MessageActionType type)
  {
    this();
    this.type = type;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public MessageAction(MessageAction other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetType()) {
      this.type = other.type;
    }
    this.goodsId = other.goodsId;
    if (other.isSetTitle()) {
      this.title = other.title;
    }
    if (other.isSetContent()) {
      this.content = other.content;
    }
    if (other.isSetLink()) {
      this.link = other.link;
    }
    if (other.isSetShareTitle()) {
      this.shareTitle = other.shareTitle;
    }
    if (other.isSetShareContent()) {
      this.shareContent = other.shareContent;
    }
    if (other.isSetShareImageUrl()) {
      this.shareImageUrl = other.shareImageUrl;
    }
    if (other.isSetShareLinkUrl()) {
      this.shareLinkUrl = other.shareLinkUrl;
    }
  }

  public MessageAction deepCopy() {
    return new MessageAction(this);
  }

  @Override
  public void clear() {
    this.type = null;
    setGoodsIdIsSet(false);
    this.goodsId = 0;
    this.title = "";

    this.content = "";

    this.link = "";

    this.shareTitle = "";

    this.shareContent = "";

    this.shareImageUrl = "";

    this.shareLinkUrl = "";

  }

  /**
   *
   * @see MessageActionType
   */
  @org.apache.thrift.annotation.Nullable
  public MessageActionType getType() {
    return this.type;
  }

  /**
   *
   * @see MessageActionType
   */
  public MessageAction setType(@org.apache.thrift.annotation.Nullable MessageActionType type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

  /** Returns true if field type is set (has been assigned a value) and false otherwise */
  public boolean isSetType() {
    return this.type != null;
  }

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

  public int getGoodsId() {
    return this.goodsId;
  }

  public MessageAction setGoodsId(int goodsId) {
    this.goodsId = goodsId;
    setGoodsIdIsSet(true);
    return this;
  }

  public void unsetGoodsId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __GOODSID_ISSET_ID);
  }

  /** Returns true if field goodsId is set (has been assigned a value) and false otherwise */
  public boolean isSetGoodsId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __GOODSID_ISSET_ID);
  }

  public void setGoodsIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __GOODSID_ISSET_ID, value);
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getTitle() {
    return this.title;
  }

  public MessageAction setTitle(@org.apache.thrift.annotation.Nullable java.lang.String title) {
    this.title = title;
    return this;
  }

  public void unsetTitle() {
    this.title = null;
  }

  /** Returns true if field title is set (has been assigned a value) and false otherwise */
  public boolean isSetTitle() {
    return this.title != null;
  }

  public void setTitleIsSet(boolean value) {
    if (!value) {
      this.title = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getContent() {
    return this.content;
  }

  public MessageAction setContent(@org.apache.thrift.annotation.Nullable java.lang.String content) {
    this.content = content;
    return this;
  }

  public void unsetContent() {
    this.content = null;
  }

  /** Returns true if field content is set (has been assigned a value) and false otherwise */
  public boolean isSetContent() {
    return this.content != null;
  }

  public void setContentIsSet(boolean value) {
    if (!value) {
      this.content = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getLink() {
    return this.link;
  }

  public MessageAction setLink(@org.apache.thrift.annotation.Nullable java.lang.String link) {
    this.link = link;
    return this;
  }

  public void unsetLink() {
    this.link = null;
  }

  /** Returns true if field link is set (has been assigned a value) and false otherwise */
  public boolean isSetLink() {
    return this.link != null;
  }

  public void setLinkIsSet(boolean value) {
    if (!value) {
      this.link = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getShareTitle() {
    return this.shareTitle;
  }

  public MessageAction setShareTitle(@org.apache.thrift.annotation.Nullable java.lang.String shareTitle) {
    this.shareTitle = shareTitle;
    return this;
  }

  public void unsetShareTitle() {
    this.shareTitle = null;
  }

  /** Returns true if field shareTitle is set (has been assigned a value) and false otherwise */
  public boolean isSetShareTitle() {
    return this.shareTitle != null;
  }

  public void setShareTitleIsSet(boolean value) {
    if (!value) {
      this.shareTitle = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getShareContent() {
    return this.shareContent;
  }

  public MessageAction setShareContent(@org.apache.thrift.annotation.Nullable java.lang.String shareContent) {
    this.shareContent = shareContent;
    return this;
  }

  public void unsetShareContent() {
    this.shareContent = null;
  }

  /** Returns true if field shareContent is set (has been assigned a value) and false otherwise */
  public boolean isSetShareContent() {
    return this.shareContent != null;
  }

  public void setShareContentIsSet(boolean value) {
    if (!value) {
      this.shareContent = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getShareImageUrl() {
    return this.shareImageUrl;
  }

  public MessageAction setShareImageUrl(@org.apache.thrift.annotation.Nullable java.lang.String shareImageUrl) {
    this.shareImageUrl = shareImageUrl;
    return this;
  }

  public void unsetShareImageUrl() {
    this.shareImageUrl = null;
  }

  /** Returns true if field shareImageUrl is set (has been assigned a value) and false otherwise */
  public boolean isSetShareImageUrl() {
    return this.shareImageUrl != null;
  }

  public void setShareImageUrlIsSet(boolean value) {
    if (!value) {
      this.shareImageUrl = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getShareLinkUrl() {
    return this.shareLinkUrl;
  }

  public MessageAction setShareLinkUrl(@org.apache.thrift.annotation.Nullable java.lang.String shareLinkUrl) {
    this.shareLinkUrl = shareLinkUrl;
    return this;
  }

  public void unsetShareLinkUrl() {
    this.shareLinkUrl = null;
  }

  /** Returns true if field shareLinkUrl is set (has been assigned a value) and false otherwise */
  public boolean isSetShareLinkUrl() {
    return this.shareLinkUrl != null;
  }

  public void setShareLinkUrlIsSet(boolean value) {
    if (!value) {
      this.shareLinkUrl = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((MessageActionType)value);
      }
      break;

    case GOODS_ID:
      if (value == null) {
        unsetGoodsId();
      } else {
        setGoodsId((java.lang.Integer)value);
      }
      break;

    case TITLE:
      if (value == null) {
        unsetTitle();
      } else {
        setTitle((java.lang.String)value);
      }
      break;

    case CONTENT:
      if (value == null) {
        unsetContent();
      } else {
        setContent((java.lang.String)value);
      }
      break;

    case LINK:
      if (value == null) {
        unsetLink();
      } else {
        setLink((java.lang.String)value);
      }
      break;

    case SHARE_TITLE:
      if (value == null) {
        unsetShareTitle();
      } else {
        setShareTitle((java.lang.String)value);
      }
      break;

    case SHARE_CONTENT:
      if (value == null) {
        unsetShareContent();
      } else {
        setShareContent((java.lang.String)value);
      }
      break;

    case SHARE_IMAGE_URL:
      if (value == null) {
        unsetShareImageUrl();
      } else {
        setShareImageUrl((java.lang.String)value);
      }
      break;

    case SHARE_LINK_URL:
      if (value == null) {
        unsetShareLinkUrl();
      } else {
        setShareLinkUrl((java.lang.String)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case GOODS_ID:
      return getGoodsId();

    case TITLE:
      return getTitle();

    case CONTENT:
      return getContent();

    case LINK:
      return getLink();

    case SHARE_TITLE:
      return getShareTitle();

    case SHARE_CONTENT:
      return getShareContent();

    case SHARE_IMAGE_URL:
      return getShareImageUrl();

    case SHARE_LINK_URL:
      return getShareLinkUrl();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case TYPE:
      return isSetType();
    case GOODS_ID:
      return isSetGoodsId();
    case TITLE:
      return isSetTitle();
    case CONTENT:
      return isSetContent();
    case LINK:
      return isSetLink();
    case SHARE_TITLE:
      return isSetShareTitle();
    case SHARE_CONTENT:
      return isSetShareContent();
    case SHARE_IMAGE_URL:
      return isSetShareImageUrl();
    case SHARE_LINK_URL:
      return isSetShareLinkUrl();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that == null)
      return false;
    if (that instanceof MessageAction)
      return this.equals((MessageAction)that);
    return false;
  }

  public boolean equals(MessageAction that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_goodsId = true && this.isSetGoodsId();
    boolean that_present_goodsId = true && that.isSetGoodsId();
    if (this_present_goodsId || that_present_goodsId) {
      if (!(this_present_goodsId && that_present_goodsId))
        return false;
      if (this.goodsId != that.goodsId)
        return false;
    }

    boolean this_present_title = true && this.isSetTitle();
    boolean that_present_title = true && that.isSetTitle();
    if (this_present_title || that_present_title) {
      if (!(this_present_title && that_present_title))
        return false;
      if (!this.title.equals(that.title))
        return false;
    }

    boolean this_present_content = true && this.isSetContent();
    boolean that_present_content = true && that.isSetContent();
    if (this_present_content || that_present_content) {
      if (!(this_present_content && that_present_content))
        return false;
      if (!this.content.equals(that.content))
        return false;
    }

    boolean this_present_link = true && this.isSetLink();
    boolean that_present_link = true && that.isSetLink();
    if (this_present_link || that_present_link) {
      if (!(this_present_link && that_present_link))
        return false;
      if (!this.link.equals(that.link))
        return false;
    }

    boolean this_present_shareTitle = true && this.isSetShareTitle();
    boolean that_present_shareTitle = true && that.isSetShareTitle();
    if (this_present_shareTitle || that_present_shareTitle) {
      if (!(this_present_shareTitle && that_present_shareTitle))
        return false;
      if (!this.shareTitle.equals(that.shareTitle))
        return false;
    }

    boolean this_present_shareContent = true && this.isSetShareContent();
    boolean that_present_shareContent = true && that.isSetShareContent();
    if (this_present_shareContent || that_present_shareContent) {
      if (!(this_present_shareContent && that_present_shareContent))
        return false;
      if (!this.shareContent.equals(that.shareContent))
        return false;
    }

    boolean this_present_shareImageUrl = true && this.isSetShareImageUrl();
    boolean that_present_shareImageUrl = true && that.isSetShareImageUrl();
    if (this_present_shareImageUrl || that_present_shareImageUrl) {
      if (!(this_present_shareImageUrl && that_present_shareImageUrl))
        return false;
      if (!this.shareImageUrl.equals(that.shareImageUrl))
        return false;
    }

    boolean this_present_shareLinkUrl = true && this.isSetShareLinkUrl();
    boolean that_present_shareLinkUrl = true && that.isSetShareLinkUrl();
    if (this_present_shareLinkUrl || that_present_shareLinkUrl) {
      if (!(this_present_shareLinkUrl && that_present_shareLinkUrl))
        return false;
      if (!this.shareLinkUrl.equals(that.shareLinkUrl))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + ((isSetGoodsId()) ? 131071 : 524287);
    if (isSetGoodsId())
      hashCode = hashCode * 8191 + goodsId;

    hashCode = hashCode * 8191 + ((isSetTitle()) ? 131071 : 524287);
    if (isSetTitle())
      hashCode = hashCode * 8191 + title.hashCode();

    hashCode = hashCode * 8191 + ((isSetContent()) ? 131071 : 524287);
    if (isSetContent())
      hashCode = hashCode * 8191 + content.hashCode();

    hashCode = hashCode * 8191 + ((isSetLink()) ? 131071 : 524287);
    if (isSetLink())
      hashCode = hashCode * 8191 + link.hashCode();

    hashCode = hashCode * 8191 + ((isSetShareTitle()) ? 131071 : 524287);
    if (isSetShareTitle())
      hashCode = hashCode * 8191 + shareTitle.hashCode();

    hashCode = hashCode * 8191 + ((isSetShareContent()) ? 131071 : 524287);
    if (isSetShareContent())
      hashCode = hashCode * 8191 + shareContent.hashCode();

    hashCode = hashCode * 8191 + ((isSetShareImageUrl()) ? 131071 : 524287);
    if (isSetShareImageUrl())
      hashCode = hashCode * 8191 + shareImageUrl.hashCode();

    hashCode = hashCode * 8191 + ((isSetShareLinkUrl()) ? 131071 : 524287);
    if (isSetShareLinkUrl())
      hashCode = hashCode * 8191 + shareLinkUrl.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(MessageAction other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetType()).compareTo(other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetGoodsId()).compareTo(other.isSetGoodsId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGoodsId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.goodsId, other.goodsId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetTitle()).compareTo(other.isSetTitle());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTitle()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.title, other.title);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetContent()).compareTo(other.isSetContent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetContent()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.content, other.content);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetLink()).compareTo(other.isSetLink());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLink()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.link, other.link);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetShareTitle()).compareTo(other.isSetShareTitle());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShareTitle()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareTitle, other.shareTitle);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetShareContent()).compareTo(other.isSetShareContent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShareContent()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareContent, other.shareContent);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetShareImageUrl()).compareTo(other.isSetShareImageUrl());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShareImageUrl()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareImageUrl, other.shareImageUrl);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetShareLinkUrl()).compareTo(other.isSetShareLinkUrl());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetShareLinkUrl()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.shareLinkUrl, other.shareLinkUrl);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("MessageAction(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (isSetGoodsId()) {
      if (!first) sb.append(", ");
      sb.append("goodsId:");
      sb.append(this.goodsId);
      first = false;
    }
    if (isSetTitle()) {
      if (!first) sb.append(", ");
      sb.append("title:");
      if (this.title == null) {
        sb.append("null");
      } else {
        sb.append(this.title);
      }
      first = false;
    }
    if (isSetContent()) {
      if (!first) sb.append(", ");
      sb.append("content:");
      if (this.content == null) {
        sb.append("null");
      } else {
        sb.append(this.content);
      }
      first = false;
    }
    if (isSetLink()) {
      if (!first) sb.append(", ");
      sb.append("link:");
      if (this.link == null) {
        sb.append("null");
      } else {
        sb.append(this.link);
      }
      first = false;
    }
    if (isSetShareTitle()) {
      if (!first) sb.append(", ");
      sb.append("shareTitle:");
      if (this.shareTitle == null) {
        sb.append("null");
      } else {
        sb.append(this.shareTitle);
      }
      first = false;
    }
    if (isSetShareContent()) {
      if (!first) sb.append(", ");
      sb.append("shareContent:");
      if (this.shareContent == null) {
        sb.append("null");
      } else {
        sb.append(this.shareContent);
      }
      first = false;
    }
    if (isSetShareImageUrl()) {
      if (!first) sb.append(", ");
      sb.append("shareImageUrl:");
      if (this.shareImageUrl == null) {
        sb.append("null");
      } else {
        sb.append(this.shareImageUrl);
      }
      first = false;
    }
    if (isSetShareLinkUrl()) {
      if (!first) sb.append(", ");
      sb.append("shareLinkUrl:");
      if (this.shareLinkUrl == null) {
        sb.append("null");
      } else {
        sb.append(this.shareLinkUrl);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class MessageActionStandardSchemeFactory implements SchemeFactory {
    public MessageActionStandardScheme getScheme() {
      return new MessageActionStandardScheme();
    }
  }

  private static class MessageActionStandardScheme extends StandardScheme<MessageAction> {

    public void read(TProtocol iprot, MessageAction struct) throws org.apache.thrift.TException {
      TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // TYPE
            if (schemeField.type == TType.I32) {
              struct.type = MessageActionType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // GOODS_ID
            if (schemeField.type == TType.I32) {
              struct.goodsId = iprot.readI32();
              struct.setGoodsIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TITLE
            if (schemeField.type == TType.STRING) {
              struct.title = iprot.readString();
              struct.setTitleIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // CONTENT
            if (schemeField.type == TType.STRING) {
              struct.content = iprot.readString();
              struct.setContentIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // LINK
            if (schemeField.type == TType.STRING) {
              struct.link = iprot.readString();
              struct.setLinkIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // SHARE_TITLE
            if (schemeField.type == TType.STRING) {
              struct.shareTitle = iprot.readString();
              struct.setShareTitleIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // SHARE_CONTENT
            if (schemeField.type == TType.STRING) {
              struct.shareContent = iprot.readString();
              struct.setShareContentIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // SHARE_IMAGE_URL
            if (schemeField.type == TType.STRING) {
              struct.shareImageUrl = iprot.readString();
              struct.setShareImageUrlIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // SHARE_LINK_URL
            if (schemeField.type == TType.STRING) {
              struct.shareLinkUrl = iprot.readString();
              struct.setShareLinkUrlIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(TProtocol oprot, MessageAction struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.isSetGoodsId()) {
        oprot.writeFieldBegin(GOODS_ID_FIELD_DESC);
        oprot.writeI32(struct.goodsId);
        oprot.writeFieldEnd();
      }
      if (struct.title != null) {
        if (struct.isSetTitle()) {
          oprot.writeFieldBegin(TITLE_FIELD_DESC);
          oprot.writeString(struct.title);
          oprot.writeFieldEnd();
        }
      }
      if (struct.content != null) {
        if (struct.isSetContent()) {
          oprot.writeFieldBegin(CONTENT_FIELD_DESC);
          oprot.writeString(struct.content);
          oprot.writeFieldEnd();
        }
      }
      if (struct.link != null) {
        if (struct.isSetLink()) {
          oprot.writeFieldBegin(LINK_FIELD_DESC);
          oprot.writeString(struct.link);
          oprot.writeFieldEnd();
        }
      }
      if (struct.shareTitle != null) {
        if (struct.isSetShareTitle()) {
          oprot.writeFieldBegin(SHARE_TITLE_FIELD_DESC);
          oprot.writeString(struct.shareTitle);
          oprot.writeFieldEnd();
        }
      }
      if (struct.shareContent != null) {
        if (struct.isSetShareContent()) {
          oprot.writeFieldBegin(SHARE_CONTENT_FIELD_DESC);
          oprot.writeString(struct.shareContent);
          oprot.writeFieldEnd();
        }
      }
      if (struct.shareImageUrl != null) {
        if (struct.isSetShareImageUrl()) {
          oprot.writeFieldBegin(SHARE_IMAGE_URL_FIELD_DESC);
          oprot.writeString(struct.shareImageUrl);
          oprot.writeFieldEnd();
        }
      }
      if (struct.shareLinkUrl != null) {
        if (struct.isSetShareLinkUrl()) {
          oprot.writeFieldBegin(SHARE_LINK_URL_FIELD_DESC);
          oprot.writeString(struct.shareLinkUrl);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class MessageActionTupleSchemeFactory implements SchemeFactory {
    public MessageActionTupleScheme getScheme() {
      return new MessageActionTupleScheme();
    }
  }

  private static class MessageActionTupleScheme extends TupleScheme<MessageAction> {

    @Override
    public void write(TProtocol prot, MessageAction struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.type.getValue());
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetGoodsId()) {
        optionals.set(0);
      }
      if (struct.isSetTitle()) {
        optionals.set(1);
      }
      if (struct.isSetContent()) {
        optionals.set(2);
      }
      if (struct.isSetLink()) {
        optionals.set(3);
      }
      if (struct.isSetShareTitle()) {
        optionals.set(4);
      }
      if (struct.isSetShareContent()) {
        optionals.set(5);
      }
      if (struct.isSetShareImageUrl()) {
        optionals.set(6);
      }
      if (struct.isSetShareLinkUrl()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetGoodsId()) {
        oprot.writeI32(struct.goodsId);
      }
      if (struct.isSetTitle()) {
        oprot.writeString(struct.title);
      }
      if (struct.isSetContent()) {
        oprot.writeString(struct.content);
      }
      if (struct.isSetLink()) {
        oprot.writeString(struct.link);
      }
      if (struct.isSetShareTitle()) {
        oprot.writeString(struct.shareTitle);
      }
      if (struct.isSetShareContent()) {
        oprot.writeString(struct.shareContent);
      }
      if (struct.isSetShareImageUrl()) {
        oprot.writeString(struct.shareImageUrl);
      }
      if (struct.isSetShareLinkUrl()) {
        oprot.writeString(struct.shareLinkUrl);
      }
    }

    @Override
    public void read(TProtocol prot, MessageAction struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.type = MessageActionType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.goodsId = iprot.readI32();
        struct.setGoodsIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.title = iprot.readString();
        struct.setTitleIsSet(true);
      }
      if (incoming.get(2)) {
        struct.content = iprot.readString();
        struct.setContentIsSet(true);
      }
      if (incoming.get(3)) {
        struct.link = iprot.readString();
        struct.setLinkIsSet(true);
      }
      if (incoming.get(4)) {
        struct.shareTitle = iprot.readString();
        struct.setShareTitleIsSet(true);
      }
      if (incoming.get(5)) {
        struct.shareContent = iprot.readString();
        struct.setShareContentIsSet(true);
      }
      if (incoming.get(6)) {
        struct.shareImageUrl = iprot.readString();
        struct.setShareImageUrlIsSet(true);
      }
      if (incoming.get(7)) {
        struct.shareLinkUrl = iprot.readString();
        struct.setShareLinkUrlIsSet(true);
      }
    }
  }

  private static <S extends IScheme> S scheme(TProtocol proto) {
    return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

